/******************************************************************************
 * Epigraph compiler                                                          *
 * Copyright © 2011 Grigorev Svyatoslav                                       *
 *                                                                            *
 * This program is free software: you can redistribute it and/or modify       *
 *     it under the terms of the GNU General Public License as published by   *
 *     the Free Software Foundation, either version 3 of the License, or      *
 *     (at your option) any later version.                                    *
 *                                                                            *
 *     This program is distributed in the hope that it will be useful,        *
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *     GNU General Public License for more details.                           *
 *                                                                            *
 *     You should have received a copy of the GNU General Public License      *
 *     along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
 ******************************************************************************/

package epg;

import java.io.File;

/**
 * @author: Grigorev Svyatoslav
 * Date: epg 2011-08-26 21:37
 */

// Компилятор языка "О"
public class run {

	static void Init() {
		Text.Reset();
		if (!Text.Ok)
			Error.Message(Text.Message);
		Scan.Init();
		Gen.Init();
	}

	static void Close() {
		GenJava.writer.close();
		Text.Close();
		System.exit(0);
	}

	public static void main(String[] args) {
		System.out.println("\nКомпилятор языка О");
		if (args.length == 0)
			Location.Path = null;
		else
			Location.Path = args[0];
		Location.Path = "HelloWorld.o";

		GenJava.init();  // Инициализация
		Init();
		//System.exit(0);
		Pars.Compile(); // Компиляция
		//	OVM.Run();      // Выполнение
		Close();	 // Завершение
	}

}